import {
	request
} from '../utils/request.js'
import store from '../store'
import {
	Toast,
	Jump
} from '../utils/tools.js'
import {
	AESencrypt
} from "@/libs/fn/mima.js"
import {
	balance,
	UserInfo
} from '@/api/Users.js'

// 果实兑换USDT
export async function Exchange(params) {
	try {
		params.paypassword = AESencrypt(params.paypassword);
		let res = await request({
			url: '/Activetion/Exchange',
			method: "post",
			data: params
		})
		if (res.success) await balance()
		return res
	} catch (e) {
		return false
	}
}

//果实兑换记录
export async function ExchangePage(params) {
	try {
		let res = await request({
			url: '/Activetion/ExchangePage',
			method: "post",
			data: params
		})
		return res
	} catch (e) {
		return false
	}
}
//[果实兑换待审核列表]   dls=营业厅||县级代理 可用
export async function ExchangeDls(params) {
	try {
		let res = await request({
			url: '/Activetion/ExchangeDls',
			method: "post",
			data: params
		})
		return res
	} catch (e) {
		return false
	}
}

//果实兑换审核   userinfo.Dls == (int)Dls.营业厅 || userinfo.Dls == (int)Dls.县级代理
export async function ExchangeReview(params) {
	try {
		let res = await request({
			url: '/Activetion/ExchangeReview',
			method: "post",
			data: params
		})
		return res
	} catch (e) {
		return false
	}
}

//领取操作  (领取记录 查收益记录  传对应的 tradetype)
export async function Receive() {
	try {
		let res = await request({
			url: '/Activetion/Receive',
			method: "post",
		})
		return res
	} catch (e) {
		return false
	}
}

//我的领取情况
export async function myFruit(params) {
	try {
		let res = await request({
			url: '/Activetion/myFruit',
			method: "post",
			data: params
		})
		return res
	} catch (e) {
		return false
	}
}